package com.ljm.boot.helloword.simpleStudy;

public class count {

    public static class Counter{
        Integer count ;
        void incream(){
            this.count++;
        }
        Counter(){
            count = 0;
        }

    }

    public static void main(String[] args) throws InterruptedException {
        Counter counter = new Counter();
        Thread t1 = new Thread(()->{
            for (int i=0;i<1000;i++) {
                counter.incream();
            }
        });
        Thread t2 = new Thread(()->{
            for (int j=0;j<1000;j++) {
                counter.incream();
            }
        });
        t1.start();
        t2.start();
        System.out.println(counter.count);
    }
}
